package com.wing.cabinet.model.response;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wing.cabinet.model.entity.CellInventoryInout;
import com.wing.cabinet.model.entity.CellInventoryInoutDetail;
import com.wing.cabinet.utils.ExcelExport;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 售刀柜上货(上货主表无展示)/领取VO
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class NeckNewExportVO {

    /**
     * ID
     */
    private Long id;

    /**
     * 创建时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    @ExcelExport(value = "领取时间",sort = 220)
    private LocalDateTime createTime;

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    @ExcelExport(value = "领取人",sort = 210)
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 存刀任务编号
     */
    @ExcelExport(value = "领新订单编号",sort = 50)
    private String code;

    /**
     * 配送单id
     */
    private Long deliveryId;

    /**
     * 操作类型
     */
    private CellInventoryInout.Type type;

    /**
    * 操作类型描述
    */
    @TableField(exist = false)
    private String typeDesc;

    public String getTypeDesc() {
        if (type!=null){
            return type.getDesc();
        }
        return "";
    }

    /**
     * 状态:
     */
    private Integer status;

    /**
     * no
     */
    private Integer no;

    /**
     * day
     */
    private Integer day;

    /**
     * 上货/领取id
     */
    private Long inoutId;

    /**
     * 柜子id
     */
    private Long cabId;

    /**
     * sku id
     */
    private Long skuId;

    /**
     * 数量
     */
    @ExcelExport(value = "数量（包装计）",sort = 110)
    private Integer quantity;
    @ExcelExport(value = "包装单位", sort = 120)
    private String unitName;
    @ExcelExport(value = "数量(基础单位计)",sort = 130)
    private Integer quantityPack;

    /**
     * 企业id
     */
    private Long companyId;

    /**
     * 公司名称
     */
    private String companyName;

    /**
     * 货道id
     */
    private Long spaceId;


    /**
     * sku code
     */
    @ExcelExport(value = "物料编号",sort = 20)
    private String skuCode;

    /**
     * 柜子编码
     */
    @ExcelExport(value = "柜子编号",sort = 70)
    private String cabCode;


    /**
     * 货道
     */
    @ExcelExport(value = "货道编号",sort = 90)
    private String spaceCode;

    /**
     * 当前库存
     */
    private Integer quantityCurrent;

    /**
     * 变动后库存
     */
    private Integer quantityAfter;

    /**
     * 产品SKU名称
     */
    @ExcelExport(value = "物料名称",sort = 10)
    private String skuName;

    /**
     * 产品规格
     */
    private String skuSpec;





    /**
     * sku 图片
     */
    private String skuPic;

    /**
     * 产品名称
     */
    private String productName;

    /**
     * 产品类型名称
     */
    @ExcelExport(value = "类型",sort = 150)
    private String productTypeName;

    /**
     * 产品分类名称
     */
    @ExcelExport(value = "分类",sort = 140)
    private String productCategoryName;

    /**
     * 产品品牌
     */
    @ExcelExport(value = "品牌",sort = 40)
    private String productBrandName;

    /**
     * 产品型号
     */
    private String productModelName;

    /**
     * 适配机床
     */
    private String deviceName;

    /**
     * 市场价
     */
    @ExcelExport(value = "单价",sort = 160)
    private BigDecimal marketPrice;

    private Integer quantityMax;

    /**
     * 是否形成账单
     */
    private CellInventoryInout.IsBill isBill;

    /**
     * 领用订单内所有产品的总价值
     */
    @TableField(exist = false)
    private BigDecimal money;
    private Long receiveLoadId;


    private String orderCode;
    /**
     * 备注
     */
    private String remark;

    @ExcelExport(value = "规格码",sort = 30)
    private String skuSpecOld;

    @ExcelExport(value = "机台",sort = 180)
    private String deviceCode;

    private Long inoutDetailId;


    private Long quantityRemaining;

    private Long quantityAlarm;

    private Long quantitySuggest;

    private CellInventoryInout.BusinessType businessType;

    public String getBusinessTypeDesc(){
        if (businessType!=null){
            return businessType.getDesc();
        }
        return "";
    }

    @ExcelExport(value = "领新类型",sort = 60)
    private String businessTypeDesc;




    private Long workOrderId;


    private Long departmentId;

    @ExcelExport(value = "部门",sort = 230)
    private String departmentName;

    /**
     * 企业自定义柜子名称
     */
    @ExcelExport(value = "企业自定义名称",sort = 80)
    private String cabName;

    /**
     * 企业编码
     */
    private String enterpriseCode;
    //@ExcelExport(value = "以旧换新编号",sort = 1)
    private String oldNewCode;


    private BigDecimal total;

    private Long processId;

    private String skuSpecValueNames;

    private String productPic;

    private String productCode;

    @ExcelExport(value = "岗位",sort = 240)
    private String roleName;

    private Long storageInventoryInoutId;


    private Integer settingTime;


    private Integer remainingTime;



    /**
     * 寿命单位  1：小时/ 2：次数
     */
    private CellInventoryInoutDetail.LifeUnit lifeUnit;


    private String lifeUnitDesc;

    public String getLifeUnitDesc(){
        if (this.lifeUnit!=null){
            return this.lifeUnit.getDesc();
        }
        return "";
    }

    @ExcelExport(value = "刀具寿命",sort = 190)
    private String remainingSettingTime;

    @ExcelExport(value = "寿命单位",sort = 200)
    private String lifeUnitName;

    private Integer quantityPackUnit;


    private Long packId;
    @ExcelExport(value = "包装规格",sort = 100)
    private String packName;
    @ExcelExport(value = "工单",sort = 170)
    private String workOrderCode;



    /**
     * 领用总数
     */
    private Integer receiveSum;
    /**
     * 预估数量
     */
    private Integer estimatedQuantity;
    /**
     * 领用总金额
     */
    private BigDecimal receiveAmount;
    @ExcelExport(value = "基础单位",sort = 131)
    private String basicsUnitName;
    @ExcelExport(value = "成本中心",sort = 229)
    private String costCenter;
    /**
     * 机台部门
     */
    @ExcelExport(value = "机台部门",sort = 181)
    private String deviceDepartmentName;

    private Long deviceDepartmentId;
}
